package com.ttg.web.dao.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.common.enums.RulesStatusEnum;
import com.ttg.model.mapper.RulesListMapper;
import com.ttg.model.mapper.VipBankInfoMapper;
import com.ttg.model.pojo.RulesList;
import com.ttg.model.pojo.VipBankInfo;
import com.ttg.web.dao.RulesListDao;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zhangHongYuan
 * @description
 * @date 2023/8/3 16:40
 */
@Repository
public class RulesListDaoImpl extends ServiceImpl<RulesListMapper, RulesList> implements RulesListDao {
    @Override
    public List<RulesList> allByStatus() {
        LambdaQueryWrapper<RulesList> wrapper = new LambdaQueryWrapper<>();
        wrapper.ne(RulesList::getStatus, RulesStatusEnum.STOP.getValue());
        return list(wrapper);
    }

    @Override
    public List<RulesList> getRulesIdAndName(Integer type) {
        LambdaQueryWrapper<RulesList> wrapper = new LambdaQueryWrapper<>();
        wrapper.select(RulesList::getId,RulesList::getRulesName)
                .eq(RulesList::getStatus,RulesStatusEnum.OPEN.getValue())
                .eq(RulesList::getRulesToType,type);
        return list(wrapper);
    }

    @Override
    public List<RulesList> allByStatusAndType(Integer type) {
        LambdaQueryWrapper<RulesList> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(RulesList::getRulesToType,type);
//        wrapper.ne(RulesList::getStatus, RulesStatusEnum.STOP.getValue());
        return list(wrapper);
    }
}
